package com.android.qjpmc.widget.manager;

import com.android.qjpmc.widget.bean.BaseRequestData;
import com.android.qjpmc.widget.retrofithelper.rxexception.RxExceptionHelper;
import com.android.qjpmc.widget.retrofithelper.rxschedulers.RxSchedulersHelper;

import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.ObservableTransformer;

/**
 * Created by Mloong on 2018/8/3.
 */

public class RxJavaHttpManager {

    public static <T> ObservableTransformer<BaseRequestData<T>, T> applyTransformer() {
        return new ObservableTransformer() {
            @Override
            public ObservableSource<T> apply(Observable upstream) {
                return upstream.compose(RxExceptionHelper.applyTransformer()).compose(RxSchedulersHelper.applyIoTransformer()).compose(RxJavaDataManager.<T>handleResult());
            }
        };
    }
 }
